<?php
require_once 'common.inc.php';

print_r($_COOKIE);
print_r($_SESSION);

if($type=="acs"){

	include_once MCC_ROOT.'/templates/msystem/system_pic.html';
}elseif($type=="rds"){

	include_once MCC_ROOT.'/templates/msystem/system_pic.html';
}elseif($type=="woso"){

		$sql="select count(*) from ps_count";
	$query=$dp->query($sql);
	$count=$dp->fetch_array($query);
	//-----------------------------------
	$yssql="select count(*) as ys from ps_down where dtype='1'";
	$ysquery=$dp->query($yssql);
	$ysys = $dp->result($ysquery,0);
	$infos['original'] = $ysys;
	$tjsql="select count(*) as ys from ps_down where dtype='0'";
	$tjquery=$dp->query($tjsql);
	$tjtj = $dp->result($tjquery,0);
	$infos['digest'] = $tjtj;
	//$infos['opercent'] = 
	//--------------------------------------	
	$iptablesql = "select count(distinct cip) num from ps_count ";
	$iptablequery = $dp->query($iptablesql);
    $iptables=0;
	$ipl = $dp->fetch_array($iptablequery);
	$iptables=$ipl['num'];
/*	
	$downiptalequery = $dp->query("select  count(*) from ps_down group by dip");
    $diptables=0;
	while($dipl = $dp->fetch_array($downiptalequery))
        {
               $diptables++;
		}
*/
    $infos['totalip']=$iptables;
	//$infos['totalip']=$count['count(*)'];//IP访问总数
	$infos['totalpage']=$count['count(*)'];//推送页面显示次数	
	$infos['downs']=$ysys+$tjtj;
	//$infos['downs']=$original+$digest;
	$infos['dpercent']=round($infos['digest']/$infos['downs'],4)*100;//下载推荐种子次数/总下载次数   
	$infos['opercent']=round($infos['original']/$infos['downs'],4)*100;//下载原始种子次数/总下载次数
//	$infos['percent']=round($infos['downs']/$infos['totalpage'],4)*100;//总下载次数/总显示次数
	//---------------------------
//	$infos['fdpercent']=ceil(($infos['digest']/$infos['downs'])*100)*3;//下载推荐种子次数/总下载次数   
//	$infos['fopercent']=ceil(($infos['original']/$infos['downs'])*100)*3;//下载原始种子次数/总下载次数
//	$infos['fpercent']=ceil(($infos['downs']/$infos['totalpage'])*100)*3;//总下载次数/总显示次数	
//		if($infos['fpercent']>300)
//		{
//			$infos['fpercent'] = 300;
//		}	
	//分别统计各个网站的访问次数
	//echo "<!--";
	$sql="select count(*)num,A.dwebsite,B.id,B.website from ps_count A left join ps_website B on A.dwebsite=B.id where enable='1' group by A.dwebsite order by num desc";
	$wsql=$dp->query($sql);
	$abc=array();
	while($wcount=$dp->fetch_array($wsql))$abc[]=$wcount;
	foreach($abc as $key => $list)
	{
		if(!$list['website'])continue;
		$webinfos.=$list['website'].':'.$list[num].'次&nbsp;&nbsp;&nbsp;';
		$sum+=$list[num];
	}
	$sql="select count(*)num from ps_count where dwebsite=0 group by dwebsite";
	$query=$dp->query($sql);
	$number=$dp->fetch_array($query);

	$other=($infos[totalpage]-$sum)-$number[num];
	include_once MCC_ROOT.'/templates/msystem/system_pic.html';
}

?>